import requests
from bs4 import BeautifulSoup

def dosth():
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
    }

    response = requests.get('http://www.hualongxiang.com', headers=headers)
    if response.status_code == 200:
        # 解析HTML内容
        print(response.text)
        soup = BeautifulSoup(response.text, 'html.parser')
        print('#################################################')

        title = soup.title.string
        print(title)
        # 抓取所有段落
        news_list = soup.select('.hot48_list > li > a')
        for news in news_list:
            print(news.text.strip())

    else:
        print(f"无法请求页面，状态码: {response.status_code}")


if __name__ == "__main__":
    dosth()
